package io.File;

import java.io.*;
import java.util.Arrays;

public class OutPutStream {
    public static void main(String[] args) throws IOException {
        //拷贝a文件到B 文件
        FileInputStream inputStream = new FileInputStream("D:\\test\\a.txt");
        FileOutputStream outputStream = new FileOutputStream("D:\\test\\b.txt",true);
        byte [] buff = new byte[1024];
        int len =-1;
        while ((len=inputStream.read(buff))!=-1){
            outputStream.write(buff);
        }
        inputStream.close();
        outputStream.close();
    }

    private static void test1() throws IOException {
        FileOutputStream outputStream = new FileOutputStream("D:\\test\\TestDemo.java",true);//加true可以追加内容在文档后面
        String str="我是赵诚挚";
        //把我是赵诚挚写在文件中
        byte[] bytes = str.getBytes();//字符串转化成字节数组
        outputStream.write(bytes);
        outputStream.close();
    }
}
